using Curriculum.Modelo.Clases;
using Curriculum.Services;

namespace Concurso.WebUserControls.Concurso
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;

	/// <summary>
	///		Summary description for Titulo.
	/// </summary>
	public class Titulo : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.Label lblNombreDocente;
		protected System.Web.UI.WebControls.Label lblTituloDocente;
		protected System.Web.UI.WebControls.Label lblTituloConcurso;
		protected System.Web.UI.WebControls.Label lblNombreConcurso;

		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!this.IsPostBack)
			{
				SetearNombreConcurso();
				SetearNombreDocente();
			}
		}

		private void SetearNombreConcurso()
		{
			string concursoId = this.Request["concursoId"];
			if( concursoId != null )
			{
				lblTituloConcurso.Visible = true;
				ConcursoService svc = new ConcursoService();
				lblNombreConcurso.Text = svc.ObtenerConcurso(concursoId).Nombre;				
			}
		}
		private void SetearNombreDocente()
		{
			string docenteId = this.Request["docenteId"];
			if( docenteId != null )
			{
				lblTituloDocente.Visible = true;
				DocenteService svc = new DocenteService();
				Docente docente = svc.ObtenerDocente(docenteId);
				lblNombreDocente.Text = docente.Apellido + " , " + docente.Nombre;				
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}
